package cn.alex.sso.project.mapper;

import cn.alex.sso.project.entity.SysClient;
import cn.hutool.core.util.ObjUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;

/**
 * @author Alex
 * @description 针对表【sys_client(应用表)】的数据库操作Mapper
 * @createDate 2024-09-24 18:59:26
 * @Entity cn.alex.sso.project.entity.SysClient
 */
public interface SysClientMapper extends BaseMapper<SysClient> {

    default LambdaQueryWrapper<SysClient> getQueryWrapper(SysClient client) {
        return new LambdaQueryWrapper<SysClient>()
                .like(StrUtil.isNotBlank(client.getName()), SysClient::getName, client.getName())
                .like(StrUtil.isNotBlank(client.getUrl()), SysClient::getUrl, client.getUrl())
                .eq(ObjUtil.isNotEmpty(client.getCategoryId()), SysClient::getCategoryId, client.getCategoryId())
                .eq(ObjUtil.isNotEmpty(client.getIsSso()), SysClient::getIsSso, client.getIsSso())
                .eq(ObjUtil.isNotEmpty(client.getStatus()), SysClient::getStatus, client.getStatus())
                .orderByAsc(SysClient::getSorted);
    }

}




